<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>车辆抵押借款${(dojk=='1')?"申请":"信息"}</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript" src="${ctxStatic }/js/wdcf.js"></script>
		<script type="text/javascript" src="${ctxStatic }/js/pccs.js"></script>
		<script type="text/javascript">
			$(function(){
				if("${error}" != ""){
					$(".fcdyrgh_up").html("错误：${error}");
				}
				else{
					$(".fcdyrgh_up").hide();
				}
				
				setup("dw_");
				
				$.validator.setDefaults({
					submitHandler : function(form) {
						form.submit();
					}
				});
				
				// 联系电话(手机/电话皆可)验证
				jQuery.validator.addMethod("isPhone", function(value, element) {
					var length = value.length;
					var mobile = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
					var tel = /^\d{3,4}-?\d{7,9}$/;
					return this.optional(element)
							|| (tel.test(value) || mobile.test(value));

				}, "请正确填写您的联系电话");

				// 开始验证
				$('#hyxxForm').validate({

					rules : {					
						
						dwmc : "required",
						dwdz1 : "required",
						dwdz2 : "required",
						dwxz : "required",
						dwdh : {
							required : true,
							isPhone : true
						},
						
						skrxm : "required",
						skyhkh : "required",
						skyh : "required",
						skyhdz : "required",
						
						lxr_jjxm : "required",
						lxr_jjdh : {
							required : true,
							isPhone : true
						},
						lxr_jjgx : "required",
						lxr_jtxm : "required",
						lxr_jtdh : {
							required : true,
							isPhone : true
						},
						lxr_jtgx : "required"
					},

					messages : {
						
						dwmc : "请输入单位名称",
						dwdz1 : "请选择单位地址",
						dwdz2 : "请输入单位详细地址",
						dwxz : "请选择单位性质",
						dwdh : {
							required : "请输入单位电话",
							isPhone : "请输入合法的电话号码"
						},
						
						skrxm : "请输入持卡人姓名",
						skyhkh : "请输入银行卡号",
						skyh : "请选择收款银行",
						skyhdz : "请输入开户行地址",
						
						lxr_jjxm : "请输入紧急联系人姓名",
						lxr_jjdh : {
							required : "请输入紧急联系人的联系电话",
							isPhone : "请输入合法的电话号码"
						},
						lxr_jjgx : "请选择与联系人关系",
						lxr_jtxm : "请输入家庭联系人姓名",
						lxr_jtdh : {
							required : "请输入家庭联系人的联系电话",
							isPhone : "请输入合法的电话号码"
						},
						lxr_jtgx : "请选择与联系人的关系"
					},

					focusInvalid : false,
					onkeyup : false
				});
				
				$("#btnSave").click(function() {
					$("#hyxxForm").submit();
				});
			})
			
			function promptinfo(prefix){
		        var address = document.getElementById(prefix+'address1');
		        var s1 = document.getElementById(prefix+'province');
		        var s2 = document.getElementById(prefix+'city');
		        var s3 = document.getElementById(prefix+'town');
		        address.value = s1.value + s2.value + s3.value;
		    }
			
			function uploadCallback(idx, id, filename){
				$("#img_"+idx).attr("src","${svr_url }pic/show?filename="+filename);
				$("#img_"+idx).css('display','block');
				$("#img_"+idx).height("240px");
				$("#img_"+idx).width("360px");
				$("#id_"+idx).val(id);
				$("#tpdz_"+idx).val(filename);
				
			}
			
		</script>
	</head>
<body>
<div class="header_tit">
	<div class="header_titbox">
	<c:if test="${dojk != '1'}">    	
        <h2 class="header_tit1">我的财富</h2>
        >
        <h3 class="header_tit2">完善信息</h3>
        >
        <h4 class="header_tit3">车辆抵押借款信息</h4>
    </c:if>
	<c:if test="${dojk == '1'}">    	
        <h2 class="header_tit1">我要借款</h2>
        >
        <h4 class="header_tit3">车辆抵押借款申请</h4>
    </c:if>
     
    </div>
</div>
<div class="jbxx_box">
	<div class="jbxx_content clearfix">
		
    	<div class="jbxx_navbox">
    	<c:if test="${dojk != '1'}">
        	<div class="jbxx_tit">完善信息</div>
            <ul>
                <li><a href="${ctx }/my/hyxx">基本信息</a></li>
                <li><a href="${ctx }/my/hyxx?flag=1&jklx=1">个人信誉借款信息</a></li>
                <li><a href="${ctx }/my/hyxx?flag=2&jklx=2">汽车抵押借款信息</a></li>
                <li><a href="${ctx }/my/hyxx?flag=3&jklx=3">房产抵押借款信息</a></li>
                <li><a href="${ctx }/my/hyxx?flag=4&jklx=4">企业信誉借款信息</a></li>
            </ul>
        </c:if>
    	<c:if test="${dojk == '1'}">
        	<div class="jbxx_tit">借款申请</div>
            <ul>               
                <li><a href="${ctx }/my/hyxx?flag=1&jklx=1&dojk=1">个人信誉借款申请</a></li>
                <li><a href="${ctx }/my/hyxx?flag=2&jklx=2&dojk=1">汽车抵押借款申请</a></li>
                <li><a href="${ctx }/my/hyxx?flag=3&jklx=3&dojk=1">房产抵押借款申请</a></li>
                <li><a href="${ctx }/my/hyxx?flag=4&jklx=4&dojk=1">企业信誉借款申请</a></li>
            </ul>
        </c:if>
 
        </div>
       
        <div class="fcdy_rightbox">
        	<p class="fcdyrgh_up">温馨提示：基本信息为必填选项</p>
        	<form:form id="hyxxForm" name="hyxxForm" modelAttribute="hyxx" method="post" action="${ctx }/my/savehyxx">
        		<input type="hidden" id="id" name="id" value="${sessionScope.hy_id}"/>
                <input type="hidden" id="flag" name="flag" value="${flag}"/>
                <input type="hidden" id="dojk" name="dojk" value="${dojk}"/>
                <input type="hidden" id="jklx" name="jklx" value="${jklx}"/>
            <c:if test="${dojk == '1'}">
            <!--借款信息-->
            <div class="fcdyrgh_down" id="jkxx">
				<h3>借款信息</h3>
				<input type="hidden" id="jkbs" name="" value="1"/>
                <div class="fcdy_box">
                	<div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">借款金额：</label>
                        <input class="fcdy_input number" type="text" id="jkje" name="jkje" value="${jkje}" placeholder="请输入借款金额"/>
                    </div>
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">借款期限：</label>
                        <input class="fcdy_input number" type="text" id="jkqx" name="jkqx" value="${jkqx}" placeholder="请输入借款期限(单位：天)"/> 
                    </div>
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">借款用途：</label>
                        <textarea class="fcdy_input" id="jkyt" name="jkyt" placeholder="可以输入20-1000个文字，您可以描述一下您的借款原因等等" style="margin: 0px; height: 90px; width: 360px;" onkeyup="this.value = this.value.substring(0,1000)" >${jkyt}</textarea>
                    </div>
                </div>    
             </div>
            </c:if>
            
            <!--工作单位信息-->
        	<div class="fcdyrgh_down" id="dwxx">
				<h3>工作单位信息</h3>
                <div class="fcdy_box">
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">单位名称：</label>
                        <input class="fcdy_input" type="text" id="dwmc" name="dwmc" value="${hyxx.dwmc}" placeholder="请输入单位名称"/>
                    </div>
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">单位电话：</label>
                        <input class="fcdy_input" type="text" id="dwdh" name="dwdh" value="${hyxx.dwdh}" placeholder="请输入单位电话"/>
                    </div>
                    <div class="fcdy_row clearfix ">
                    	<label class="fcdy_rowlabel">单位性质：</label>
                    	<select class="fcdy_input" id="dwxz" name="dwxz">
                    		<option value="">---请选择---</option>
							<c:forEach items="${dwxzlist }" var="map">
								<option value="${map.value}" ${(hyxx.dwxz==map.value) ? "selected=\"selected\"" : ""}>${map.key}</option>
							</c:forEach>
						</select>
                    </div>
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">选择单位地址：</label>
						<select class="fcdy_dz" id="dw_province" name="dw_province">
						</select>
                        <select class="fcdy_dz" id="dw_city" name="dw_city">
						</select>
                        <select class="fcdy_dz" id="dw_town" name="dw_town">
						</select>
                    </div>
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">单位地址：</label>
                        <input class="fcdy_input" id="dw_address1" name="dwdz1" value="${hyxx.dwdz1}" style=" width:360px;" type="text" readonly/>
                    </div>  
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">详细地址：</label>
                        <input class="fcdy_input" id="dw_address2" name="dwdz2" value="${hyxx.dwdz2}" style=" width:360px;" type="text" placeholder="请输入单位详细地址"/>
                    </div> 
               </div>
            </div>
			<!--银行卡信息-->
            <div class="fcdyrgh_down" id="yhkxx">
				<h3>银行卡信息</h3>
                <div class="fcdy_box">
                	<div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">持卡人姓名：</label>
                        <input class="fcdy_input" type="text" id="skrxm" name="skrxm" value="${hyxx.skrxm}" placeholder="请输入持卡人姓名"/>
                    </div>
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">银行卡号：</label>
                        <input class="fcdy_input" type="text" id="skyhkh" name="skyhkh" value="${hyxx.skyhkh}" placeholder="请输入银行卡号"/>
                    </div>
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">收款银行：</label>
						<select class="fcdy_input" id="skyh" name="skyh">
							<option value="">---请选择银行---</option>
							<c:forEach items="${banklist }" var="map">
								<option value="${map.value}" ${(hyxx.skyh==map.value) ? "selected=\"selected\"" : ""}>${map.key}</option>
							</c:forEach>
						</select>
                    </div>
                    <div class="fcdy_row clearfix">
                    	<label class="fcdy_rowlabel">开户地址：</label>
                        <input class="fcdy_input" type="text" id="skyhdz" name="skyhdz" value="${hyxx.skyhdz}" placeholder="请输入开户行详细地址"/>
                    </div>    
               </div>
            </div>
            <!--紧急联系人-->
            <div class="fcdyrgh_down clearfix" id="lxrxx">
				<h3>联系人信息</h3>
				<div class="fcdy_box">
	                <div class="fcdy_row clearfix">
	                    <label class="fcdy_rowlabel">紧急联系人姓名：</label>
	                    <input class="fcdy_input" type="text" id="lxr_jjxm" name="lxr_jjxm" value="${hyxx.lxr_jjxm}" placeholder="请输入紧急联系人姓名"/>
	                </div>    
	                <div class="fcdy_row clearfix">
	                    <label class="fcdy_rowlabel">紧急联系人电话：</label>
	                    <input class="fcdy_input" type="text" id="lxr_jjdh" name="lxr_jjdh" value="${hyxx.lxr_jjdh}" placeholder="请输入紧急联系人电话"/>
	                </div>
	                <div class="fcdy_row clearfix">
	                	<label class="fcdy_rowlabel">与联系人关系</label>
	                    <select class="fcdy_input" id="lxr_jjgx" name="lxr_jjgx" >
	                    	<option value="">---请选择---</option>
							<c:forEach items="${jjlxrlist }" var="map">
								<option value="${map.value}" ${(hyxx.lxr_jjgx==map.value) ? "selected=\"selected\"" : ""}>${map.key}</option>
							</c:forEach>
						</select>
	                </div>               
	                <div class="fcdy_row clearfix" >
	                    <label class="fcdy_rowlabel">家庭联系人姓名：</label>
	                    <input class="fcdy_input" type="text" id="lxr_jtxm" name="lxr_jtxm" value="${hyxx.lxr_jtxm}" placeholder="请输入家庭联系人姓名"/>
	                </div>
	                <div class="fcdy_row clearfix">
	                    <label class="fcdy_rowlabel">家庭联系人电话：</label>
	                    <input class="fcdy_input" type="text" id="lxr_jtdh" name="lxr_jtdh" value="${hyxx.lxr_jtdh}" placeholder="请输入家庭联系人电话"/>
	                </div>
	                <div class="fcdy_row clearfix">
	                	<label class="fcdy_rowlabel">与联系人关系</label>
	                    <select class="fcdy_input" id="lxr_jtgx" name="lxr_jtgx">
	                    	<option value="">---请选择---</option>
							<c:forEach items="${jtlxrlist }" var="map">
								<option value="${map.value}" ${(hyxx.lxr_jtgx==map.value) ? "selected=\"selected\"" : ""}>${map.key}</option>
							</c:forEach>
						</select>
	                </div> 
                </div>               
            </div>
            
            <div class="zl_box">
				<h3>上传资料</h3>
                <div class="zlsc_downbox">
                	<p class="wxts_box">温馨提示：1、图片文件要求大小1M内，JPG、JPEG、PNG格式； 2、您可以将资料拍照或扫描后上传，要求图片清晰。</p>
                    <div class="table_box">
                    	<table class="table_red clearfix">
                        	<thead>
                                <tr>
                                    <th width="150px"><div>证件图片名称<i></i></div></th>
                                    <th width="340px"><div>预览<i></i></div></th>                                    
                                    <th><div>操作</div></th>
                                </tr>
                            </thead>
	                            <c:forEach items="${hyxx.cljkcl}" var="zjtp" varStatus="status">
	                            <tbody>
	                            	<tr>
	                                	<td class="table_bodytit" width="120px">${zjtp.zjmc}</td>
	                                    <td width="310px" style=" text-align:left">		                                    
		                                	<img id="img_${status.index}" ${(zjtp.id == '0')? "style=\"display:none\"" :"style=\"height:240px;width:360px\""} src="${svr_url }pic/show?filename=${zjtp.tpdz }"/>
		                                    <input type="hidden" id="id_${status.index}" name="id_${status.index}" value="${zjtp.id }" />
		                                    <input type="text" id="tpdz_${status.index}" name="tpdz_${status.index}" value="${zjtp.tpdz }" class="fcdy_input required" readonly/>
	                                    </td>
	                                    <td>
	                                    	<a class="td_sc" href="javascript:void(0);" onclick="windowOpen('${ctx}/my/upjkcl?hy_id=${hyxx.id }&zpzl=${zjtp.zpzl }&id=${zjtp.id }&idx=${status.index}','up','360','150')">上传</a>                                        
	                                    </td>
	                                </tr>
	                            </tbody>
	                           </c:forEach>
                        </table>
					</div>
				</div>
			</div>
                           
            </form:form>
            <div class="zl_box">
            	<button class="fcdy_btn" id="btnSave">保存</button>
        	</div>
        </div>
    </div>
</div>

</body>
</html>